<?php
/**
 * 后台管理员的登录退出
 * Author: lyun
 * Date: 2018/3/23
 * Created by Panxsoft.
 */

use App\Http\Controllers\Admin\Panx\DeviceController;
use App\Http\Controllers\Admin\Panx\MaterialController;
use Illuminate\Support\Facades\Route;

Route::group([
    'prefix'=>'panx',
    'namespace'=>'Admin\Panx',
    'middleware'=>'AdminAuth'
], function(){
    /**
     *  panx后台职员管理
     */
    Route::group([
        'namespace'=>'StaffManage'
    ], function(){
        /**
         *  panx后台职员管理
         *
         * @see \App\Http\Controllers\Admin\Panx\StaffManage\PanxStaffController
         */
        Route::resource('/staff', 'PanxStaffController')
            ->names(\App\Http\Controllers\Admin\Panx\StaffManage\PanxStaffController::ROUTES);

        /**
         * panx后台职员启用和禁用切换
         *
         * @see \App\Http\Controllers\Admin\Panx\StaffManage\PanxStaffController::patchEnabled()
         */
        Route::patch('/staff-status/{staff_id}', 'PanxStaffController@patchEnabled')
            ->name(\App\Http\Controllers\Admin\Panx\StaffManage\PanxStaffController::ROUTES['patch']);
    });

    /**
     *  panx 后台查看设备账号信息列表
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceAccountController
     */
    Route::resource('/device-account', 'DeviceAccountController');

    /**
     *  panx 后台物资的管理
     *
     * @see \App\Http\Controllers\Admin\Panx\MaterialController
     */
    Route::resource('/material', 'MaterialController')
        ->names(MaterialController::ROUTE_NAMES);

    /**
     *  panx 后台物资的管理 - 显示出售列表
     *
     * @see \App\Http\Controllers\Admin\Panx\MaterialController::sellList()
     */
    Route::get('/material-sell-list', 'MaterialController@sellList')
        ->name(MaterialController::ROUTE_NAMES['sellList']);

    /**
     *  panx 后台物资的管理 - 从已有采购物资信息,保存采购记录
     *
     * @see \App\Http\Controllers\Admin\Panx\MaterialController::storeMaterialPurchase()
     */
    Route::post('/store-material-purchase', 'MaterialController@storeMaterialPurchase')
        ->name(MaterialController::ROUTE_NAMES['storeMaterialPurchase']);

    /**
     *  panx后台设备的卖出操作
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController::sellDevice()
     */
    Route::post('/sell-device', 'DeviceController@sellDevice')
        ->name(DeviceController::ROUTES['sell_device']);

    /**
     *  panx后台设备卖出的列表
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController::sellList()
     */
    Route::get('/sell-list', 'DeviceController@sellList')
        ->name(\App\Http\Controllers\Admin\Panx\DeviceController::ROUTES['sell_list']);

    /**
     *  panx后台 更新设备账号信息
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController::updateDeviceAccount()
     */
    Route::post('/update-device-account', 'DeviceController@updateDeviceAccount')
        ->name(\App\Http\Controllers\Admin\Panx\DeviceController::ROUTES['update_device_account']);

    /**
     *  panx后台从已有device中添加采购信息
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController::buyDevice()
     */
    Route::post('/buy-device', 'DeviceController@buyDevice')
        ->name(\App\Http\Controllers\Admin\Panx\DeviceController::ROUTES['buy_device']);

    /**
     *  panx后台设备的管理
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController
     */
    Route::resource('/device', 'DeviceController')
        ->names(\App\Http\Controllers\Admin\Panx\DeviceController::ROUTES);

    /**
     *  获取 devices 表中的数据
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceController::deviceList()
     */
    Route::get('/device-list', 'DeviceController@deviceList')
        ->name(\App\Http\Controllers\Admin\Panx\DeviceController::ROUTES['device_list']);

    /**
     *  panx后台设备试装参数的管理
     *
     * @see \App\Http\Controllers\Admin\Panx\DeviceSpecController
     */
    Route::resource('/device-spec', 'DeviceSpecController');

    /**
     *  panx后台代理客户的启用和禁用
     *
     * @see \App\Http\Controllers\Admin\Panx\CustomerController::patchStatus()
     */
    Route::patch('/patch-status/{customer_id}', 'CustomerController@patchStatus')
        ->name(\App\Http\Controllers\Admin\Panx\CustomerController::ROUTE_NAMES['patch_status']);

    /**
     *  panx 后台免登录访问客户的后台
     *
     * @see \App\Http\Controllers\Admin\Panx\CustomerController::loginCustomerAdmin()
     */
    Route::get('/login-customer-admin/{customer_id}', 'CustomerController@loginCustomerAdmin');

    /**
     *  panx后台代理客户的管理
     *
     * @see \App\Http\Controllers\Admin\Panx\CustomerController
     */
    Route::resource('/customer', 'CustomerController')
        ->names(\App\Http\Controllers\Admin\Panx\CustomerController::ROUTE_NAMES);

    /**
     *  panx后台促销活动的管理
     *
     * @see \App\Http\Controllers\Admin\Panx\ActivityController
     */
    Route::resource('/activity', 'ActivityController')
        ->names(\App\Http\Controllers\Admin\Panx\ActivityController::ROUTES);

    /**
     *  panx后台查看操作日志
     *
     * @see \App\Http\Controllers\Admin\Panx\OperateLogController
     */
    Route::resource('/operate-log', 'OperateLogController');

    Route::group([
        'prefix'=>'dashboard',
    ], function() {

        /**
         * panx后台查看用户画像
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::userCrowd()
         */
        Route::get('/user-crowd', 'DashboardController@userCrowd');

        /**
         * panx后台查看测肤占比数据
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::skinProportion()
         */
        Route::get('/skin-proportion', 'DashboardController@skinProportion');

        /**
         * panx后台查看单品试妆统计
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::assetTryOnCount()
         */
        Route::get('/asset-try-on-count', 'DashboardController@assetTryOnCount');

        /**
         * panx后台查看设备试妆统计数据
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::deviceAccountTryOnCount()
         */
        Route::get('/device-account-try-on-count', 'DashboardController@deviceAccountTryOnCount');

        /**
         * panx后台查看客户统计数据
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::customers()
         */
        Route::get('/customers', 'DashboardController@customers');

        /**
         * panx后台查看设备类型试戴统计数据
         * @see \App\Http\Controllers\Admin\Panx\DashboardController::createDevice()
         */
        Route::get('/create-device', 'DashboardController@createDevice');
    });

    /**
     *  panx后台商品相关的管理
     */
    Route::group([
        'namespace'=>'Product'
    ], function() {

        /**
         *  panx后台商品类别的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductCategoryController
         */
        Route::resource('/category', 'ProductCategoryController')
            ->names(\App\Http\Controllers\Admin\Panx\Product\ProductCategoryController::ROUTES);

        /**
         *  panx后台商品模型的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductModelController
         */
        Route::resource('/product-model', 'ProductModelController');

        /**
         *  panx后台商品规格的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductSpecController
         */
        Route::resource('/product-spec', 'ProductSpecController');

        /**
         *  panx后台商品属性的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductAttributeController
         */
        Route::resource('/product-attribute', 'ProductAttributeController');

        /**
         *  panx后台商品品牌的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductBrandController
         */
        Route::resource('/brand', 'ProductBrandController');

        /**
         *  panx后台商品标签的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductTagController
         */
        Route::resource('/tag', 'ProductTagController')
            ->names(\App\Http\Controllers\Admin\Panx\Product\ProductTagController::ROUTES);

        /**
         *  panx后台商品详情的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\ProductController
         */
        Route::resource('/product', 'ProductController')
            ->names(\App\Http\Controllers\Admin\Panx\Product\ProductController::ROUTES);

        /**
         * panx后台 产品标签关联肤质检测项目的管理
         *
         * @see \App\Http\Controllers\Admin\Panx\Product\SkinDetectionItemController
         */
        Route::resource('/skin-detection-item', 'SkinDetectionItemController')
            ->names(\App\Http\Controllers\Admin\Panx\Product\SkinDetectionItemController::ROUTES);
    });
});


